package com.ws.genercity.demo09;

import java.lang.reflect.Field;
import java.lang.reflect.Method;

/**
 * @author 13353
 */
public class Test09 {
    public static void main(String[] args) {
        Erasure<Integer> cla = new Erasure<>();
        //通过反射，类型通配符上限
        Class aClass = cla.getClass();
        //获取所有的成员变量
        Field[] declaredFields = aClass.getDeclaredFields();
        for (Field declaredField : declaredFields) {
            //打印名称和类型名
            // key:Object
            System.out.println(declaredField.getName() +":" +declaredField.getType().getSimpleName());
        }
        System.out.println("======================");
        Method[] declaredMethods = cla.getClass().getDeclaredMethods();
        for (Method declaredMethod : declaredMethods) {
            //打印方法名，，返回值类型
            // getKey:Number
            //setKey:void
            //show:List
            System.out.println(declaredMethod.getName() +":" + declaredMethod.getReturnType().getSimpleName());
        }
    }
}
